home *** CD-ROM | disk | FTP | other *** search
/ DarkBASIC - The Ultimate 3D Game Creator / PCactive 8 CD1 - DarkBasic.iso / SOFTWARE / DEMOS / DarkForge2000 / 3d_sprites / 3d_sprites.dba next >
Encoding:
Text File  |  2000-04-12  |  1.4 KB  |  69 lines

  1. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  2. `              3D Sprites
  3. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4. ` By Rich Davey (rich@fatal-design.com)
  5. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  6. ` Music listened  to while  coding this
  7. ` The Mind of Goa (various artists)
  8. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  9. ` Note:
  10. `
  11. `    My own personal testing gave the following results on a Pentium3-450
  12. `    with 128Megs of RAM and a GeForce 256 Pro graphics card
  13. `
  14. `    175 64x64 sprites at 75 fps
  15. `    350 32x32 sprites at 75 fps
  16. `    525 16x16 sprites at 75 fps
  17. `
  18. `    Change the stars value below for maximum effect!
  19. `    Gain extra speed by turning the print command off.
  20.  
  21. sync rate 0
  22. sync on
  23. hide mouse
  24.  
  25. randomize 1000
  26.  
  27. load image "bubble_64x64.bmp",1
  28. `load image "bubble_32x32.bmp",1
  29. `load image "bubble_16x16.bmp",1
  30.  
  31. stars=150
  32.  
  33. dim x#(stars) 
  34. dim y#(stars)
  35.  
  36. for i = 1 to stars
  37.     x#(i)=rnd(640.0)-320.0
  38.     y#(i)=rnd(480.0)-240.0
  39.     sprite i,x#,y#,1
  40.     set sprite i,0,1
  41. next i
  42.  
  43. sx#=1.03985 : sy#=1.03985
  44. slidex#=320.0 : slidey#=240.0
  45.  
  46. ink rgb(255,255,255),0
  47.  
  48. do
  49.  
  50.     cls 0
  51.  
  52.     for j=1 to stars
  53.         sprite j,x#(j)+slidex#,y#(j)+slidey#,1
  54.         x#(j)=x#(j)*sx#
  55.         y#(j)=y#(j)*sy#
  56.         if x#(j) > 640.0 then x#(j)=x#(j)-640.0
  57.         if y#(j) > 480.0 then y#(j)=y#(j)-480.0
  58.         if x#(j) < -640.0 then x#(j)=x#(j)+640.0
  59.         if y#(j) < -480.0 then y#(j)=y#(j)+480.0
  60.     next j
  61.  
  62.     set cursor 0,0 : print "FPS ", screen fps()
  63.     set cursor 0,12 : print "SPRITES ", stars
  64.  
  65.     sync 
  66.  
  67. loop
  68.  
  69.